package com.example.chapter8broadcastrevicer;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MyReceiver2 extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        String action = intent.getAction();
        Log.e(MainActivity.TAG, "（优先级2 ）onReceive  Action : "+action);
        String stringExtra = intent.getStringExtra(MainActivity.ACTION);
        Log.e(MainActivity.TAG, "（优先级2）onReceive stringExtra: "+stringExtra);
        abortBroadcast();
        if (getAbortBroadcast()){
            Log.e(MainActivity.TAG, "优先级2 终止了低优先级接受的广播" );
        }else {
            Log.e(MainActivity.TAG, "优先级2 没有终止了低优先级接受的广播" );
        }
    }
}